<template>
<view class="content">
	<view :style='{"minHeight":"100vh","padding":"0","overflow":"hidden","alignItems":"flex-start","flexWrap":"wrap","background":"#f0f8fa","flexDirection":"row","display":"flex","width":"100%","height":"auto"}'>
		<swiper :style='{"width":"100%","background":"#fff","height":"400rpx"}' class="swiper" :indicator-dots='true' :autoplay='true' :circular='true' indicator-active-color='#ffcc00' indicator-color='rgba(0, 0, 0, .3)' :duration='500' :interval='5000' :vertical='false'>
			<swiper-item :style='{"width":"100%","background":"#fff","height":"400rpx"}' v-for="(swiper,index) in swiperList" :key="index" @tap="onSwiperTap(swiper)">
				<image :style='{"width":"100%","objectFit":"cover","display":"block","height":"400rpx"}' mode="aspectFill" :src="baseUrl+swiper.img"></image>
				<view v-if="false" :style='{"width":"100%","padding":"0 8rpx","lineHeight":"60rpx","fontSize":"28rpx","color":"#333","background":"#fff"}'>{{ swiper.title }}</view>
			</swiper-item>
		</swiper>
		<view class="cu-bar bg-white search" :style='{"border":"0px solid #ff9593","padding":"0","margin":"40rpx auto 40rpx","borderRadius":"12rpx","background":"none","display":"flex","width":"calc(100% - 48rpx)","height":"auto","zIndex":"9"}'>
			<picker :style='{"padding":"0 0 0 20rpx","borderColor":"#ff9593","borderRadius":"0px 0 0 0px","background":"#ffcc00","borderWidth":"0px 0 0px 0px","width":"60rpx","lineHeight":"80rpx","borderStyle":"solid","height":"80rpx"}' v-if="queryList.length>1" mode="selector" :range="queryList" range-key="queryName" :value="queryIndex" @change="queryChange">
				<text class="icon iconfont icon-jiantou18" :style='{"width":"40rpx","lineHeight":"80rpx","fontSize":"40rpx","color":"#fff"}'></text>
			</picker>
			<view :style='{"margin":"0 0px 0 0","borderColor":"#ff9593","borderRadius":"0","flex":"1","background":"#ffcc00","borderWidth":"0","lineHeight":"80rpx","position":"relative","borderStyle":"solid","height":"80rpx"}' v-if="queryIndex==0" class="search-form round">
				<text class="icon iconfont " :style='{"color":"#999","left":"0px","textAlign":"center","display":"none","width":"80rpx","fontSize":"32rpx","lineHeight":"80rpx","position":"absolute","right":"0px"}'></text>
				<input :style='{"border":"0","padding":"12rpx 20rpx 12rpx 20rpx","color":"#333","borderRadius":"0","background":"rgba(255,255,255,.5)","width":"100%","lineHeight":"60rpx","fontSize":"28rpx","height":"60rpx"}' v-model="searchForm.dishinformationnameofdishes" type="text" placeholder="菜品名称" ></input>
			</view>
			<button :style='{"border":"0","padding":"0px","margin":"0","color":"#33","borderRadius":"0 0px 0px 0","background":"url(http://codegen.caihongy.cn/20240221/b18460867bc646ae9f709f491dcdbcc5.png) no-repeat center center / 48rpx,#ffcc00","width":"116rpx","lineHeight":"80rpx","fontSize":"28rpx","height":"80rpx"}' v-if="queryIndex==0" @tap="onPageTap('dishinformation')" class="cu-btn shadow-blur round"></button>
		</view>
		<!-- menu -->
        <view style="width: 100%" v-if="swiperMenuList.length">
            <swiper :style='{"padding":"0 0 12rpx","boxShadow":"0 4rpx 0px rgba(0,0,0,.1)","margin":"20rpx auto","borderRadius":"8rpx","flexWrap":"wrap","background":"#fff","display":"flex","width":"calc(100% - 48rpx)","justifyContent":"space-between","order":"2"}' class="swiper">
                <swiper-item v-for="(swiper,index) in (new Array(Number(Math.ceil(swiperMenuList.length / (rows * column)))).fill('').map((val, i) => i+1))" :key="index">
                    <view v-for="(row, index1) in (new Array(Number(rows)).fill('').map((val, i) => i+1))" :key="index1" style="display: flex;flex-wrap: wrap;">
                        <view v-for="(col, index2) in (new Array(Number(column)).fill('').map((val, i) => i+1))" :key="index2" v-if="(((row+rows*(swiper-1) -1)*column + col -1)<swiperMenuList.length)" :style='{"width":"25%","padding":"12rpx 0","margin":"10rpx 0","height":"auto"}' class="menu-list">
                            <view :class="swiperMenuList[(row+rows*(swiper-1) -1)*column + col -1].child[0].appFrontIcon"
								<!-- #ifdef MP-WEIXIN -->
								@tap="menuClick" :data-tablename="swiperMenuList[(row+rows*(swiper-1) -1)*column + col -1].child[0].tableName"
								<!-- #endif -->
								<!-- #ifndef MP-WEIXIN -->
								@tap="onPageTap2(swiperMenuList[(row+rows*(swiper-1) -1)*column + col -1].child[0].tableName)" 
								<!-- #endif -->
								:style='{"padding":"0px","margin":"0px auto","color":"#fff","borderRadius":"100%","textAlign":"center","background":"#ffcc00","display":"block","width":"88rpx","lineHeight":"88rpx","fontSize":"64rpx","height":"88rpx"}'>
                            </view>
                            <view :style='{"padding":"0","margin":"12rpx auto 0","color":"#333","textAlign":"center","width":"100%","lineHeight":"28rpx","fontSize":"28rpx"}'>{{swiperMenuList[(row+rows*(swiper-1) -1)*column + col -1].child[0].menu.split("列表")[0]}} </view>
                        </view>
                    </view>
                </swiper-item>
            </swiper>
        </view>
		<!-- menu -->
		<!-- 关于我们 -->
		<view :style='{"padding":"0  0 32rpx","margin":"20rpx auto","borderRadius":"8rpx","alignItems":"center","flexWrap":"wrap","background":"#fff","display":"flex","width":"calc(100% - 48rpx)","position":"relative","height":"auto","order":"4"}'>
			<view :style='{"padding":"0 12rpx","margin":"0","borderColor":"#ffcc00","color":"#333","textAlign":"center","borderRadius":"8rpx 8rpx 0 0","background":"#fdf6ec","borderWidth":"6rpx 0 0","width":"100%","fontSize":"32rpx","lineHeight":"80rpx","borderStyle":"solid","fontWeight":"600","height":"80rpx"}'>{{aboutUsDetail.title}}</view>
			<view :style='{"margin":"0px 0 0","color":"#333","textAlign":"center","display":"none","width":"100%","lineHeight":"1","fontSize":"28rpx"}'>{{aboutUsDetail.subtitle}}</view>
			<view :style='{"padding":"0 20rpx","margin":"40rpx 0 0","borderRadius":"0","background":"none","display":"flex","width":"40%","justifyContent":"space-between","height":"auto","order":"2"}'>
				<img :style='{"width":"100%","margin":"0 0px","objectFit":"cover","borderRadius":"0px","display":"block","height":"160rpx"}' v-if="aboutUsDetail.picture1" :src="baseUrl+aboutUsDetail.picture1">
				<img :style='{"width":"31%","margin":"0 0px","objectFit":"cover","borderRadius":"16rpx","display":"none","height":"160rpx"}' v-if="aboutUsDetail.picture2" :src="baseUrl+aboutUsDetail.picture2">
				<img :style='{"width":"31%","margin":"0 0px","objectFit":"cover","borderRadius":"16rpx","display":"none","height":"160rpx"}' v-if="aboutUsDetail.picture3" :src="baseUrl+aboutUsDetail.picture3">
			</view>
			<view :style='{"padding":"0 20rpx","margin":"24rpx 0 0px 0","color":"rgb(102, 102, 102)","alignItems":"center","display":"flex","overflow":"hidden","borderRadius":"0","background":"none","width":"60%","lineHeight":"48rpx","fontSize":"28rpx","order":"2","height":"auto"}' v-html="aboutUsDetail.content"></view>
			<view :style='{"border":"0","padding":"0 30rpx","margin":"40rpx auto 20rpx","borderRadius":"8rpx","textAlign":"center","background":"#ffcc00","display":"none","width":"auto","lineHeight":"56rpx","order":"30"}'>
			  <text :style='{"color":"#f5f5f5","fontSize":"24rpx"}'>更多</text>
			  <text class="icon iconfont icon-gengduo1" :style='{"color":"#f5f5f5","fontSize":"24rpx"}'></text>
			</view>
			<view :style='{"width":"100%","position":"absolute","top":"-200rpx","background":"url(http://codegen.caihongy.cn/20231220/f7e2906a88da4261917ac452b2a8858c.png) no-repeat center top /100% 100%","display":"none","height":"160rpx"}' />
			<view :style='{"width":"50%","background":"url(http://codegen.caihongy.cn/20201114/7856ba26477849ea828f481fa2773a95.jpg) 0% 0% / cover no-repeat","display":"none","height":"160rpx"}' />
		</view>
		<!-- 商品推荐 -->
		<view class="listBox recommend" :style='{"width":"calc(100% - 48rpx)","padding":"0 0 10rpx","margin":"20rpx auto","borderRadius":"0 0 8rpx 8rpx","background":"#fff","order":"3"}'>
			<view class="title" :style='{"padding":"0 24rpx","margin":"0","borderColor":"#ffcc00","borderRadius":"8rpx 8rpx 0 0","textAlign":"center","background":"#fdf6ec","borderWidth":"6rpx 0 0","width":"100%","lineHeight":"80rpx","borderStyle":"solid","height":"auto"}'>
				<view :style='{"color":"#333","fontSize":"32rpx","fontWeight":"600"}'>菜品信息推荐</view>
			</view>
			<!-- 样式3 -->
			<view class="list-box style3" :style='{"width":"100%","padding":"10rpx 0 0","margin":"0","height":"auto"}'>
				<view @tap="onDetailTap('dishinformation',product.id)" v-for="(product,index) in dishinformationlist" :key="index" class="list-item" :style='{"padding":"20rpx","margin":"0 0 0px","borderRadius":"0px","alignItems":"flex-start","flexWrap":"wrap","background":"#fff","display":"flex","width":"100%","height":"auto"}'>
					<image :style='{"width":"200rpx","objectFit":"cover","display":"block","height":"260rpx"}' class="list-item-image" mode="aspectFill" v-if="product.pictureofdishes.substring(0,4)=='http'" :src="product.pictureofdishes"></image>
					<image :style='{"width":"200rpx","objectFit":"cover","display":"block","height":"260rpx"}' class="list-item-image" mode="aspectFill" v-else :src="product.pictureofdishes?baseUrl+product.pictureofdishes.split(',')[0]:''"></image>
					<view class="list-item-body" :style='{"minHeight":"240rpx","padding":"0 0 0 20rpx","margin":"0","alignItems":"center","flexWrap":"wrap","background":"url(http://codegen.caihongy.cn/20240221/8e2fddf1cb4644f6b32d79a4137c914d.png) no-repeat right bottom","display":"flex","width":"calc(100% - 200rpx)","position":"relative","height":"auto"}'>
						<view :style='{"padding":"0 0px","margin":"0","overflow":"hidden","whiteSpace":"nowrap","color":"#333","width":"100%","lineHeight":"40rpx","fontSize":"24rpx","textOverflow":"ellipsis"}' class="list-item-title">{{product.nameofdishes}}</view>
						<view :style='{"padding":"0 0px","margin":"0","color":"#000","borderRadius":"16rpx","textAlign":"center","background":"none","width":"auto","lineHeight":"48rpx","fontSize":"32rpx","fontWeight":"600","height":"48rpx","order":"11"}' class="list-item-pirce">￥{{product.price}}</view>
						<view :style='{"width":"100%","padding":"0 0px","order":"6"}'>
						  <text class="icon iconfont icon-shijian21" :style='{"margin":"0 4rpx 0 0","lineHeight":"1.5","fontSize":"24rpx","color":"#666"}'></text>
						  <text :style='{"color":"#666","lineHeight":"1.5","fontSize":"24rpx"}'>{{product.addtime}}</text>
						</view>
						<view :style='{"padding":"0 0px","margin":"0 10rpx 0 0"}'>
						  <text class="icon iconfont icon-geren16" :style='{"margin":"0 4rpx 0 0","lineHeight":"1.5","fontSize":"24rpx","color":"#666"}'></text>
						  <text :style='{"color":"#666","lineHeight":"1.5","fontSize":"24rpx"}'>{{product.merchantnumber}}</text>
						</view>
						<view :style='{"padding":"0 0px","margin":"0 10rpx 0 0","display":"inline-block"}'>
						  <text class="icon iconfont icon-shoucang10" :style='{"margin":"0 4rpx 0 0","lineHeight":"1.5","fontSize":"24rpx","color":"#666"}'></text>
						  <text :style='{"color":"#666","lineHeight":"1.5","fontSize":"24rpx"}'>{{product.storeupnum}}</text>
						</view>
					</view>
				</view>
			</view>
		</view>
		<!-- 商品推荐 -->
		
		<!-- 商品列表 -->
		<!-- 商品列表 -->
		<!-- 新闻资讯 -->
		<view class="listBox news" :style='{"width":"calc(100% - 48rpx)","padding":"0","margin":"40rpx auto","borderRadius":"8rpx","background":"#fff","order":"6"}'>
			<view class="title" :style='{"padding":"0 20rpx","margin":"0 auto","borderColor":"#ffcc00","textAlign":"center","display":"block","justifyContent":"space-between","borderRadius":"8rpx 8rpx 0 0","background":"#fdf6ec","borderWidth":"6rpx 0 0","width":"calc(100% - 0px)","lineHeight":"80rpx","position":"relative","borderStyle":"solid"}'>
				<view :style='{"color":"#333","fontSize":"32rpx","fontWeight":"600"}'>公告信息</view>
				<view :style='{"position":"absolute","right":"20rpx","alignItems":"center","top":"0px","justifyContent":"center","display":"flex"}' @tap="onPageTap('news')">
				  <text :style='{"color":"#888","fontSize":"28rpx"}'>更多</text>
				  <text class="icon iconfont " :style='{"color":"#888","fontSize":"28rpx"}'></text>
				</view>
			</view>
		  <!-- 样式5 -->
		  <view class="news-box2" :style='{"width":"100%","padding":"24rpx","margin":"0","height":"auto"}'>
			<block v-for="(item,index) in news" :key="index">
			  <view @tap="onNewsDetailTap(item.id)" v-if="index==0" class="list-item" :style='{"width":"100%","padding":"0","margin":"0 0 20rpx","position":"relative","height":"auto"}'>
				<image :style='{"width":"100%","objectFit":"cover","display":"block","height":"400rpx"}' mode="aspectFill" class="listmpic" :src="baseUrl+item.picture"></image>
				<view :style='{"width":"100%","padding":"10rpx 0","position":"absolute","left":"0","bottom":"0","background":"rgba(0,0,0,.3)"}'>
					<view :style='{"padding":"0 20rpx","overflow":"hidden","whiteSpace":"nowrap","color":"#fff","width":"100%","lineHeight":"1.5","fontSize":"28rpx","textOverflow":"ellipsis","fontWeight":"600"}' class="title">{{item.title}}</view>
					<view :style='{"padding":"0 20rpx","margin":"0","overflow":"hidden","whiteSpace":"nowrap","color":"#fff","width":"100%","lineHeight":"1.5","fontSize":"28rpx","textOverflow":"ellipsis"}' class="text">{{item.introduction}}</view>
					<view :style='{"padding":"0 20rpx"}'>
					  <text class="icon iconfont icon-shijian21" :style='{"margin":"0 4rpx 0 0","lineHeight":"1.5","fontSize":"24rpx","color":"#fff"}'></text>
					  <text :style='{"color":"#fff","lineHeight":"1.5","fontSize":"24rpx"}'>{{item.addtime}}</text>
					</view>
					<view :style='{"padding":"0 20rpx"}'>
					  <text class="icon iconfont icon-geren16" :style='{"margin":"0 4rpx 0 0","lineHeight":"1.5","fontSize":"24rpx","color":"#fff"}'></text>
					  <text :style='{"color":"#fff","lineHeight":"1.5","fontSize":"24rpx"}'>{{item.name}}</text>
					</view>
					<view :style='{"padding":"0 20rpx","display":"inline-block"}'>
					  <text class="icon iconfont icon-zan10" :style='{"margin":"0 4rpx 0 0","lineHeight":"1.5","fontSize":"24rpx","color":"#fff"}'></text>
					  <text :style='{"color":"#fff","lineHeight":"1.5","fontSize":"24rpx"}'>{{item.thumbsupnum}}</text>
					</view>
					<view :style='{"padding":"0 20rpx","display":"inline-block"}'>
					  <text class="icon iconfont icon-shoucang10" :style='{"margin":"0 4rpx 0 0","lineHeight":"1.5","fontSize":"24rpx","color":"#fff"}'></text>
					  <text :style='{"color":"#fff","lineHeight":"1.5","fontSize":"24rpx"}'>{{item.storeupnum}}</text>
					</view>
					<view :style='{"padding":"0 20rpx","display":"inline-block"}'>
					  <text class="icon iconfont icon-chakan9" :style='{"margin":"0 4rpx 0 0","lineHeight":"1.5","fontSize":"24rpx","color":"#fff"}'></text>
					  <text :style='{"color":"#fff","lineHeight":"1.5","fontSize":"24rpx"}'>{{item.clicknum}}</text>
					</view>
				</view>
			  </view>
			  <view @tap="onNewsDetailTap(item.id)" v-if="index>0" class="list-item" :style='{"padding":"0 0 10rpx","borderColor":"#ccc","margin":"0 0 20rpx 0","borderWidth":"0 0 2rpx 0","background":"url(http://codegen.caihongy.cn/20240221/8e2fddf1cb4644f6b32d79a4137c914d.png) no-repeat right center","width":"100%","borderStyle":"solid","height":"auto"}'>
				<view :style='{"padding":"0 20rpx","overflow":"hidden","whiteSpace":"nowrap","color":"#333","width":"100%","lineHeight":"1.5","fontSize":"28rpx","textOverflow":"ellipsis","fontWeight":"600"}' class="title">{{item.title}}</view>
				<view :style='{"padding":"0 20rpx","margin":"0","overflow":"hidden","whiteSpace":"nowrap","color":"#666","width":"calc(100% - 48rpx)","lineHeight":"1.5","fontSize":"28rpx","textOverflow":"ellipsis"}' class="text">{{item.introduction}}</view>
				<view :style='{"padding":"0 20rpx"}'>
				  <text class="icon iconfont icon-shijian21" :style='{"margin":"0 4rpx 0 0","lineHeight":"1.5","fontSize":"24rpx","color":"#666"}'></text>
				  <text :style='{"color":"#666","lineHeight":"1.5","fontSize":"24rpx"}'>{{item.addtime}}</text>
				</view>
				<view :style='{"padding":"0 20rpx"}'>
				  <text class="icon iconfont icon-geren16" :style='{"margin":"0 4rpx 0 0","lineHeight":"1.5","fontSize":"24rpx","color":"#666"}'></text>
				  <text :style='{"color":"#666","lineHeight":"1.5","fontSize":"24rpx"}'>{{item.name}}</text>
				</view>
				<view :style='{"padding":"0 20rpx","display":"inline-block"}'>
				  <text class="icon iconfont icon-zan10" :style='{"margin":"0 4rpx 0 0","lineHeight":"1.5","fontSize":"24rpx","color":"#666"}'></text>
				  <text :style='{"color":"#666","lineHeight":"1.5","fontSize":"24rpx"}'>{{item.thumbsupnum}}</text>
				</view>
				<view :style='{"padding":"0 20rpx","display":"inline-block"}'>
				  <text class="icon iconfont icon-shoucang10" :style='{"margin":"0 4rpx 0 0","lineHeight":"1.5","fontSize":"24rpx","color":"#666"}'></text>
				  <text :style='{"color":"#666","lineHeight":"1.5","fontSize":"24rpx"}'>{{item.storeupnum}}</text>
				</view>
				<view :style='{"padding":"0 20rpx","display":"inline-block"}'>
				  <text class="icon iconfont icon-chakan9" :style='{"margin":"0 4rpx 0 0","lineHeight":"1.5","fontSize":"24rpx","color":"#666"}'></text>
				  <text :style='{"color":"#666","lineHeight":"1.5","fontSize":"24rpx"}'>{{item.clicknum}}</text>
				</view>
			  </view>
			</block>
		  </view>
		</view>
		<!-- 新闻资讯 -->
	</view>
</view>
</template>

<script>
    import menu from '@/utils/menu'
	import '@/assets/css/global-restaurant.css'
	import uniIcons from "@/components/uni-ui/lib/uni-icons/uni-icons.vue"
	export default {
		components: {
			uniIcons
		},
		data() {
			return {
				options2: {
					effect: 'flip',
					loop : true
				},
				options3: {
					effect: 'cube',
					loop : true,
					cubeEffect: {
						shadow: true,
						slideShadows: true,
						shadowOffset: 20,
						shadowScale: 0.94,
					}
				},
				rows: 2,
				column: 4,
				iconArr: [
				  'cuIcon-same',
				  'cuIcon-deliver',
				  'cuIcon-evaluate',
				  'cuIcon-shop',
				  'cuIcon-ticket',
				  'cuIcon-cascades',
				  'cuIcon-discover',
				  'cuIcon-question',
				  'cuIcon-pic',
				  'cuIcon-filter',
				  'cuIcon-footprint',
				  'cuIcon-pulldown',
				  'cuIcon-pullup',
				  'cuIcon-moreandroid',
				  'cuIcon-refund',
				  'cuIcon-qrcode',
				  'cuIcon-remind',
				  'cuIcon-profile',
				  'cuIcon-home',
				  'cuIcon-message',
				  'cuIcon-link',
				  'cuIcon-lock',
				  'cuIcon-unlock',
				  'cuIcon-vip',
				  'cuIcon-weibo',
				  'cuIcon-activity',
				  'cuIcon-friendadd',
				  'cuIcon-friendfamous',
				  'cuIcon-friend',
				  'cuIcon-goods',
				  'cuIcon-selection'
				],
                role : '',
                aboutUsDetail: {},
                menuList: [],
                swiperMenuList:[],
                user: {},
                tableName:'',
				btnColor: ['#409eff','#67c23a','#909399','#e6a23c','#f56c6c','#356c6c','#351c6c','#f093a9','#a7c23a','#104eff','#10441f','#a21233','#503319'],
				queryList:[
					{
						queryName:"菜品名称",
					},
				],
				queryIndex: 0,
				searchForm:{
					dishinformationnameofdishes:'',
				},
				CustomBar: '0',

				//轮播
				swiperList: [],
				dishinformationlist: [],
				news: [],
			}
		},
		watch: {
		},
		mounted() {
		},
		computed: {
			baseUrl() {
				return this.$base.url;
			},
		},
        async onLoad(){
            
        },
		async onShow() {
			this.swiperMenuList = []
			this.role = uni.getStorageSync("appRole");
			let table = uni.getStorageSync("nowTable");
			let res = await this.$api.session(table);
			this.user = res.data;
			this.tableName = table;
			let menus = menu.list();
			this.menuList = menus;
			this.menuList.forEach((item,key) => {
			    if(key==0) {
			        item.frontMenu.forEach((item2,key2) => {
			            if(item2.child[0].buttons.indexOf("查看")>-1) {
			                this.swiperMenuList.push(item2);
			            }
			        })
			    }
			})
            this.btnColor = this.btnColor.sort(()=> {
                    return (0.5-Math.random());
            });
            // let res;
			// 轮播图
			let swiperList = []
			res = await this.$api.list('config', {
				page: 1,
				limit: 5
			});
			for (let item of res.data.list) {
				if (item.name.indexOf('picture') >= 0 && item.value && item.value!="" && item.value!=null ) {
					swiperList.push({
						img: item.value,
                        title: item.name,
						url: item.url
					});
				}
			}
			if (swiperList) {
				this.swiperList = swiperList;
			}
			

            this.getAboutUs();
			// 推荐信息
			this.getRecommendList()
			this.getHomeList()
			this.getNewsList()
		},
		methods: {
			uGetRect(selector, all) {
				return new Promise(resolve => {
					uni.createSelectorQuery()
					.in(this)
					[all ? 'selectAll' : 'select'](selector)
					.boundingClientRect(rect => {
						if (all && Array.isArray(rect) && rect.length) {
							resolve(rect);
						}
						if (!all && rect) {
							resolve(rect);
						}
					})
					.exec();
				});
			},
			cloneData(data) {
				return JSON.parse(JSON.stringify(data));
			},
			newsTabClick2(index){
				this.newsIndex2 = index
				this.getNewsList()
			},
			async getNewsList(){
				let res;
				let params = {
					page: 1,
					limit: 6,
					sort: 'id',
					order: 'desc',
				}
				// 公告信息
				res = await this.$api.list('news', params)
				this.news = res.data.list
			},
			homeTabClick2(index,name){
				this['home' + name + 'Index2'] = index
				this.getHomeList()
			},
			async getHomeList(){
				let res;
				let params;
			},
			recommendTabClick2(index,name){
				this[name + 'Index2'] = index
				this.getRecommendList()
			},
			async getRecommendList(){
				let res;
				let params;
				// 推荐信息
				params = {
					page: 1,
					limit: 4,
				}
				if(uni.getStorageSync("appUserid")) {
					res = await this.$api.recommend2('dishinformation', params);
				} else {
					res = await this.$api.recommend('dishinformation', params);
				}
				this.dishinformationlist = res.data.list
				

			},
			//查询条件切换
			queryChange(e) {
				this.queryIndex=e.detail.value;
				this.searchForm.dishinformationnameofdishes="";
			},
			//轮播图跳转
			onSwiperTap(e) {
				if(e.url) {
					if (e.url.indexOf('https') != -1) {
						// #ifdef MP-WEIXIN
						uni.navigateTo({
						    url: '../../common/linkOthers/linkOthers?url=' + encodeURIComponent(e.url),
						});
						return false
						// #endif
						window.open(e.url)
					} else {
						this.$utils.jump(e.url)
					}
				}
			},
            async getAboutUs() {
                let res = await this.$api.info('aboutus', 1)
                this.aboutUsDetail = res.data;
            },
			// 新闻详情
			onNewsDetailTap(id) {
				this.$utils.jump(`../news-detail/news-detail?id=${id}`)
			},
			// 推荐列表点击详情
			onDetailTap(tableName, id) {
				this.$utils.jump(`../${tableName}/detail?id=${id}`)
			},
			onPageTap(tableName){
				if(this.queryIndex==0) {
					uni.setStorageSync('indexQueryCondition',this.searchForm.dishinformationnameofdishes);
					this.searchForm.dishinformationnameofdishes = '';
				}

				uni.navigateTo({
					url: `../${tableName}/list`,
					fail: function(){
						uni.switchTab({
							url: `../${tableName}/list`
						});
					}
				});
				// this.$utils.jump(`../${tableName}/list`)
			},
			// #ifdef MP-WEIXIN
			menuClick(e){
				this.onPageTap2(e.currentTarget.dataset.tablename)
			},
			// #endif
            onPageTap2(index) {
				let url = '../' + index + '/list'
				if(index=='forum'){
					url = '../forum-index/forum-index'
				}
                uni.setStorageSync("useridTag",0);
                uni.navigateTo({
                    url: url,
                    fail: function() {
                        uni.switchTab({
                            url: url
                        });
                    }
                });
            }
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		min-height: calc(100vh - 44px);
		box-sizing: border-box;
	}

</style>
